﻿@model Kavaa.Modules.PortailMedical.Presentation.Models.MyViewModel
@{
    ViewBag.Title = "Reservation";
    Layout = null;
}

@using System.Web.Optimization
@using BootstrapSupport
@using NavigationRoutes

<!DOCTYPE html>
<html lang="en">
    <head> 
          <meta charset="utf-8">
        <title>@ViewBag.Title</title>
       @*<meta name="viewport" content="width=device-width, initial-scale=1.0">*@
        <link href="@Styles.Url("~/content/csscss")" rel="stylesheet"/>
                <link href="@Styles.Url("~/Content/css-responsive")" rel="stylesheet" type="text/css" />
        <link href="@Styles.Url("~/Content/body.css")" rel="stylesheet" type="text/css" />
              <link href="@Styles.Url("~/Content/bootstrap.min.css")" rel="stylesheet" type="text/css" />
        <link href="@Styles.Url( "~/Content/bootstrap-responsive.css")" rel="stylesheet" type="text/css" />
@*        @RenderSection("head", required: false)*@
        @Html.Partial("_html5shiv")
        @* favicons and touch icons go here *@
       @Scripts.Render("~/jsjs")
   <script type="text/javascript">
       $(document).ready(function () {
          // alert("ready");
           $("#endTime").change(function () {
               alert("change");
               var fin = $(this).val();//Date Fin
               var findate = new Date(fin);
               var findatelong = findate.getTime();
               //date debut
               var debut = $("#startTime").val();
               var debutdate = new Date(debut);
               var debutdatelong = debutdate.getTime();
               alert("ajax traitement1");
               $.ajax({

                   type: 'POST',
                   url: '/Cabinet/IsMedecinFree',
                   async: false,
                   data: { DateDebut: debutdatelong, DateFin: findatelong },

                   success: function (result) {
                       if (result.returnvalue) {
                           $.getJSON("/Cabinet/GetBlocsDispo", { DateDebut: debutdatelong, DateFin: findatelong },
                       function (carData) {
                           var select = $("#ddlModels");
                           select.empty();
                           select.append($('<option/>', {
                               value: 0,
                               text: "--Choix"
                           }));
                           $.each(carData, function (index, itemData) {

                               select.append($('<option/>', {
                                   value: itemData.Value,
                                   text: itemData.Text
                               }));
                           });
                       });
                       }
                       else { alert("Doc not free"); }



                   },

               });
           });
           $("#ddlModels").change(function () {
               var idmodel = $(this).val();
               alert(idmodel);
               $.ajax({
                   url: '/Cabinet/GetProprietesCategorie',//ça marche
                   async: false,
                   type: 'POST',
                   dataType: 'json',
                   data: "id_categorie=" + idmodel,

                   success: function (dat) {
                       document.getElementById("name").innerHTML = "";
                       for (var i in dat) {
                           document.getElementById("name").innerHTML += "&nbsp; <b>"+dat[i].Name + "</b>: " + dat[i].Value +"<br/>";
                       }
                       document.getElementById("div").style.display = "block";
                   },
                   error: function (xhr, ajaxOptions, thrownError) {
                       alert(xhr.status);
                       alert("toto");
                       alert(thrownError);
                   }

               });
           });
       });
       function clignotement() {
           if (document.getElementById("MonElement").style.display == "block")
               document.getElementById("MonElement").style.display = "none";
           else
               document.getElementById("MonElement").style.display = "block";
       }
       // mise en place de l appel régulier de la fonction toutes les 0.5 secondes 
       setInterval("clignotement()", 500);
</script>
                                              <div class="navbar navbar-inverse navbar-top" >
           <div class="navbar-inner">     
        </div> 
         </div>
              <div>
  
     @{
         
         
         var prenomuser = ((Kavaa.Modules.PortailMedical.Entity.Utilisateur)(Session["user"])).Prenom;
       var nomuser = ((Kavaa.Modules.PortailMedical.Entity.Utilisateur)(Session["user"])).Name;}
          <table class="container">
         
              <tr>
                  <td>
            <img src="/Content/images/mediciMaroc.png" /> </td>
                  <td class="pull-right">
                      <br /> 
            <p style="text-align:right"><i class=" icon-user"> </i>&nbsp; &nbsp; @prenomuser  @nomuser  &nbsp; &nbsp;  @Html.ActionLink("Se déconnecter","Deconnexion")&nbsp; &nbsp; </p>
               </td>
           
        
        </tr>
        </table>
                               </div>
        <style>
            p {
  text-align: left;
}
p span {
  float: left;
}

            .welll {
                        width: 200px;
                        min-height: 0px;
                        padding: 9px;
                        margin-bottom: 20px;
                        background-color: #f5f5f5;
                        border: 1px solid #e3e3e3;
                        -webkit-border-radius: 4px;
                        -moz-border-radius: 4px;
                        border-radius: 4px;
                        -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.05);
                        -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.05);
                        box-shadow: inset 0 1px 1px rgba(0,0,0,0.05);
                        color: blue;
                  }
         
        </style>
</head>
    <body style="padding:0px;background-color:#fafafa"> 


        <div class="container" style="background-color:#eeeeee;border:ridge;border-top:none;border-color:#FBFBFB" >

         <div class="navbar">
            <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
          <div class="nav-collapse collapse">
        <ul class="nav">
      <li > @Html.ActionLink("Accueil","AccueilCabinet")</li>
      <li > @Html.ActionLink("Accréditation","Accreditation")</li>
      <li class="active">@Html.ActionLink("Réservation","AccueilReservation")</li>
      <li><a href="#">Rapports d'interventions</a></li>
      <li>@Html.ActionLink("Comptes Cabinet","ComptesCabinet")</li>
  
    </ul>
            <form class="navbar-search pull-right">
      <i class="icon-search"></i>
  <input type="text" class="search-query" placeholder="Recherche">
</form>
  </div>
          </div>
      </div>
             </div>


	<div id='calendar' style="margin:10px"></div>
	<div id="event_edit_container">
		<form>
			<input type="hidden" />
			<ul>
				<li>
					<span>Date: </span><span class="date_holder"></span> 
				</li>
				<li>
					<label for="start">Date Début: </label><select name="start" id ="startTime"><option value="">Select Start Time</option></select>
				</li>
  
				<li>
					<label for="end">DateFin: </label><select name="end" id="endTime"><option value="">Select End Time</option></select>
				</li>
                    <p> 
                        <label> Blocs disponibles: </label>
                            @Html.DropDownListFor(Model => Model.categorie, new SelectList(Enumerable.Empty<SelectListItem>(), "Id", "title"), 
                            "--Choix", new { id = "ddlModels" })
                    </p>
                   <div id="div" style="display:none" class="welll"> 
				   <div id="name" style="width:inherit"></div> 
                    </div>
				<li>
					<label for="body">Remarques: </label><textarea name="body"></textarea>
				</li>
			</ul>
		</form>
	</div>
      
    </div>
        <div class="container">
               <br />
         <b style="color:blue"> < </b> <u> <b>  @Html.ActionLink("Retour au menu","AccueilReservation") </b> </u>
      <hr>
   
            <footer>
                <p>&copy; Kavaa @System.DateTime.Now.ToString("yyyy")</p>
            </footer> 
            </div>
        <div id="alertt" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="popupLabel" aria-hidden="true"  >
				      <div class="modal-header">
					    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					    <h3 id="popupalert">Comment &ccedil;a marche ?</h3>
				      </div>
                      <div style="padding-left:35px">
                          <table>
                 
                               <tr><th><br/></th></tr>
                               <tr><th><br/></th></tr>
                               <tr><th id="message"> ci bien ça .

                                   Ca marche comme ça.
                                   </th></tr>
                               <tr><th><br /></th></tr>
                               <tr><th><br/></th></tr>
                          </table>
                      </div>
                      <div class="modal-footer">
                           <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Retour</button>
                      </div>
                  </div>
	
</body>
</html>